//
// Created by Kan Zheng on 13/10/2017.
//


#ifndef _PACKT_DROIDBLASTER_HPP_
#define _PACKT_DROIDBLASTER_HPP_

#include <android_native_app_glue.h>
#include "EventHandler.hpp"
#include "Context.hpp"
#include "TimeService.hpp"
#include "Types.hpp"

namespace dbs {
    class DroidBlaster : public packt::EventHandler {
    public:
        DroidBlaster(packt::Context& context, android_app* pApplication);
        virtual ~DroidBlaster();
    protected:
        status onActivate();
        void onDeactivate();
        status onStep();
        void onStart();
        void onResume();
        void onPause();
        void onStop();
        void onDestroy();
        void onSaveState(void** pData, int32_t* pSize);
        void onConfigurationChanged();
        void onLowMemory();
        void onCreateWindow();
        void onDestroyWindow();
        void onGainFocus();
        void onLostFocus();
    private:
        void clear();
        void drawCursor(int pSize, int pX, int pY);

    private:
        android_app* mApplication;
        ANativeWindow_Buffer mWindowBuffer;
        packt::TimeService* mTimeService;
        bool mInitialized;
        double mPosX;
        double mPosY;
        const int32_t mSize;
        const float mSpeed;
    };
}
#endif